#doc-----------------------------------------------------------
#所有参数 显示格式为NBT路径(NBT路径以宏参数内的register为根目录)
#String | run.spawned: 箭矢生成时运行的命令
#Compound | run.spawned_tick: 内部有 tick（在多少Tick后运行） command（Tick计时结束后运行的命令）参数，内部参数必选
#String | run.hit_block: 箭矢击中方块时运行的命令
#String | run.hit_entity: 箭矢击中实体时运行的命令
#String | run.hit_entity_victim: 箭矢击中实体时受害者运行的命令
#String | run.bow_break: 弓损坏时运行的命令
#String | run.flying: 箭矢飞行时运行
#String | default_hit_sound: 箭矢命中发出的默认声音
#Int | item_model: (默认为minecraft:bow)
#String | item_modifier: 生成物品时应用物品修饰器的路径
#String | skill: 这把弓的技能,填入技能注册时的id
#doc-----------------------------------------------------------

#格式检查
execute if data storage dab:register parser.run.spawned run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.run.spawned"}
execute if data storage dab:register parser.run.spawned_tick run function dab:system/register/format_check {type:"compound",path:"from storage dab:register parser.run.spawned_tick"}
execute if data storage dab:register parser.run.spawned_tick.tick run function dab:system/register/format_check {type:"int",path:"from storage dab:register parser.run.spawned_tick.tick"}
execute if data storage dab:register parser.run.spawned_tick.command run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.run.spawned_tick.command"}
execute if data storage dab:register parser.run.hit_block run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.run.hit_block"}
execute if data storage dab:register parser.run.hit_entity run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.run.hit_entity"}
execute if data storage dab:register parser.run.hit_entity_victim run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.run.hit_entity_victim"}
execute if data storage dab:register parser.run.bow_break run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.run.bow_break"}
execute if data storage dab:register parser.run.flying run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.run.flying"}
execute if data storage dab:register parser.default_hit_sound run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.default_hit_sound"}
execute if data storage dab:register parser.item_model run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.item_model"}
execute if data storage dab:register parser.item_modifier run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.item_modifier"}
execute if data storage dab:register parser.skill run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.skill"}
execute unless data storage dab:register parser run return fail

#必选检查
execute if data storage dab:register parser.run.spawned_tick unless data storage dab:register parser.run.spawned_tick.tick run return run function dab:system/register/.fail/custom_tip {tip:'{"text":"注册失败,spawned_tick中缺少tick或command","color":"red"}'}
execute if data storage dab:register parser.run.spawned_tick unless data storage dab:register parser.run.spawned_tick.command run return run function dab:system/register/.fail/custom_tip {tip:'{"text":"注册失败,spawned_tick中缺少tick或command","color":"red"}'}

#skill
execute if data storage dab:register parser.skill run function dab:system/register/bow/set_skill with storage dab:register parser

#删除冗余键
function dab:system/register/.redundant_key_killer/start {protections:["run.spawned","run.spawned_tick","run.spawned_tick.tick","run.spawned_tick.command","run.hit_block","run.hit_entity","run.hit_entity_victim","run.bow_break","run.flying","default_hit_sound","item_model","item_modifier","skill"]}